package com.foreknow.elmboot.controller;

import com.foreknow.elmboot.po.Orders;
import com.foreknow.elmboot.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/OrderController")
public class OrderController {
    @Autowired
    private OrderService orderService;

    @RequestMapping("/orderList")
    public List<Orders> orderList(String userId){
        return orderService.orderList(userId);
    }

    @RequestMapping("/creatOrder")
    public int creatOrder(Orders orders){
        return orderService.creatOrder(orders);
    }

    @RequestMapping("/orderById")
    public Orders orderById(Integer orderId){
        return orderService.orderById(orderId);
    }

    @RequestMapping("/payOver")
    public int payOver(Integer orderId){
        return orderService.payOver(orderId);
    }
}
